package org.darkforest.common.services.impl;

import org.darkforest.dao.mapper.ConsultMapper;
import org.darkforest.dao.mapper.ConsultTypeMapper;
import org.darkforest.common.services.ConsultService;
import org.darkforest.model.Consult;
import org.darkforest.model.ConsultSearchBean;
import org.darkforest.model.ConsultType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by liu on 15/1/18.
 */
@Service("consultService")
public class ConsultServiceImpl implements ConsultService {
    @Autowired
    private ConsultTypeMapper consultTypeMapper;
    @Autowired
    private ConsultMapper consultMapper;

    @Override
    public List getConsultTypeList(){
        return consultTypeMapper.getConsultTypeList();
    }

    @Override
    public void selectListByCondition(ConsultSearchBean page) {
        page.setResultList(consultMapper.selectListByCondition(page));
    }

    public Consult getConsultById(int id){
       return  consultMapper.selectByPrimaryKey(id);
    }

    public void deleteByIds(List ids){
        consultMapper.deleteByIds(ids);
    }

    public int updateConsult(Consult consult){
        return consultMapper.updateByPrimaryKeySetConsultReply(consult);
    }

    @Override
    public int deleteConsultTypeByPrimaryKey(Integer ctId) {
        return consultTypeMapper.deleteByPrimaryKey(ctId);
    }

    @Override
    public int updateConsultTypeByPrimaryKeySelective(ConsultType record) {
        return consultTypeMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int insertConsultType(ConsultType record) {
        return consultTypeMapper.insert(record);
    }

    @Override
    public ConsultType selectConsultTypeByPrimaryKey(Integer ctId) {
        return consultTypeMapper.selectByPrimaryKey(ctId);
    }
}
